/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Server;

import java.net.MalformedURLException;
import java.rmi.AccessException;
import java.rmi.AlreadyBoundException;
import java.rmi.Naming;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author PhiNguyen
 */
public class MyServer {
    public static void main(String[] arg){
        try {
            // Tao ra registry
            LocateRegistry.createRegistry(10);
            
            Engine server = new Engine();
            Naming.bind("rmi://localhost:10/ATM", server);
            
            System.out.println("Server is listening...");
        } catch (MalformedURLException | AlreadyBoundException ex) {
            Logger.getLogger(MyServer.class.getName()).log(Level.SEVERE, null, ex);
        } catch (AccessException ex) {
            Logger.getLogger(MyServer.class.getName()).log(Level.SEVERE, null, ex);
        } catch (RemoteException ex) {
            Logger.getLogger(MyServer.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}
